package com.itheima.controller;

import com.itheima.pojo.PageResult;
import com.itheima.pojo.Result;
import com.itheima.service.EmpService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: 渣哥
 * @CreateTime: 2025/5/28  16:18
 * @Description: 员工控制器
 */

@Slf4j
@RequestMapping("/emps")
@RestController
public class EmpController {
    @Autowired
    private EmpService empService;
    /**
     * 分页查询
     */
    @GetMapping
    public Result page(@RequestParam(defaultValue = "1")  Integer start,
                       @RequestParam(defaultValue = "10") Integer pageSize){
        log.info("查询员工信息：page={},pageSize={}",start,pageSize);
        PageResult pageResult= empService.page(start,pageSize);
        return Result.success(pageResult);
    }
}
